// pages/index/HomeNav/FM/fm.js
const app = getApp()
Page({
  data: {
    active: 0,
    fmList: [],
    pageNum: 1,
    pageSize: 10,
    downurl: app.globalData.downurl,
    // 节流阀，false表示没有加载数据；true表示正在加载数据
    isLoading: false
  },

  getData() {
    
    // 显示加载中
    this.setData({
      isLoading: true
    })
    wx.showLoading({
      title: '数据加载中...',
      icon: 'loading'
    })
    const that = this
    this.audioCtx = wx.createAudioContext('myAudio')
    wx.request({
      url: 'http://localhost:8080/fm/find',
      data: {
        pageNum: that.data.pageNum,
        pageSize: that.data.pageSize
      },
      success(res) {
        that.setData({
          fmList: res.data.data
        })
        console.log(that.data.fmList)
      }
    })
    // 关闭加载提示框
    wx.hideLoading()
  },
  onLoad() {
    this.getData()
  },

  onChange(event) {
    wx.showToast({
      title: `切换到标签 ${event.detail.name}`,
      icon: 'none',
    });
  },
})